import {
  IsNotEmpty,
  IsNumber,
  IsOptional,
  IsString,
  Length,
  Max,
  Min,
} from 'class-validator';
import { ApiProperty } from '@nestjs/swagger';

export class CreateMessageDto {
  @ApiProperty({ description: '消息标题', example: '订单状态更新' })
  @IsString()
  @IsNotEmpty()
  @Length(2, 100)
  title: string;

  @ApiProperty({ description: '消息内容', example: '您的订单已发货' })
  @IsString()
  @IsNotEmpty()
  content: string;

  @ApiProperty({
    description: '消息类型: 1-系统消息, 2-交易消息, 3-聊天消息',
    example: 1,
  })
  @IsNumber()
  @IsNotEmpty()
  @Min(1)
  @Max(3)
  type: number;

  @ApiProperty({ description: '接收用户ID', required: false })
  @IsNumber()
  @IsOptional()
  toUserId?: number;
}
